import { Controller, Get, Param, Query, Request } from '@nestjs/common';
import { PositionDto } from '../dto/position.dto';
import { PositionService } from '../services/position.service';

@Controller('position')
export class PositionController {

  constructor(private positionService: PositionService) { }

  @Get()
  async getCityInfoForPosition(@Request() req) {
    const city = this.positionService.getLocationForIp(req);
    return city;
  }

  @Get('place')
  async searchPlaceForKeyword(@Query() query) {
    const { keyword, cityName } = query;
    const city = this.positionService.searchPlace(keyword, cityName);
    return city;
  }

  @Get(':geohash')
  async getPositionForGeohash(@Param() param): Promise<PositionDto> {
    const geohash = param.geohash;
    return ;
  }

}